package com.zhuchaooasystem.adapter.holder;

import android.support.v7.widget.LinearLayoutManager;
import android.view.ViewGroup;
import android.widget.TextView;

import com.jude.easyrecyclerview.EasyRecyclerView;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;
import com.zhuchaooasystem.R;
import com.zhuchaooasystem.entity.SignListEntity;

/**
 * @author yinsi
 */
public class SignListHolder extends BaseViewHolder<SignListEntity.ResultBean.SuccessfulBean.ListdataBean> {
    private TextView txt_date;
    private EasyRecyclerView recycle;

    public SignListHolder(ViewGroup parent) {
        super(parent, R.layout.item_activity_sign);
        //----
        txt_date = $(R.id.item_act_sign_txt_date);
        recycle = $(R.id.item_act_sign_recycle);
    }

    @Override
    public void setData(final SignListEntity.ResultBean.SuccessfulBean.ListdataBean data) {
        txt_date.setText(data.getTitle());
        recycle.setLayoutManager(new LinearLayoutManager(getContext()));
        if (null != data.getDetails() && data.getDetails().size() > 0) {
            recycle.setAdapterWithProgress(new RecyclerArrayAdapter<SignListEntity.ResultBean.SuccessfulBean.ListdataBean.DetailsBean>(getContext(), data.getDetails()) {
                @Override
                public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
                    return new SignListItemHolder(parent);
                }
            });
        }
    }

}
